const Qs = require('qs');
// 统一接口
class Service {
    // 登录接口
    login(self, params) {
        return self.$axios({
            method: 'post',
            url: `/api/Login/handle`,
            data: Qs.stringify(params)
        }).then(
            (response) => response, (error) => error
        );
    }
    // 注销接口
    loginOut(self) {
        return self.$axios({
            method: 'post',
            url: `/api/Login/logout`,
        }).then(
            (response) => response, (error) => error
        );
    }
    // 用户列表
    getUserList(self, params) {
        return self.$axios({
            method: 'post',
            url: `/api/User/userList`,
            data: Qs.stringify(params)
        }).then(
            (response) => response, (error) => error
        );
    }
    // 用户编辑
    userEdit(self, params) {
        return self.$axios({
            method: 'post',
            url: `/api/User/userEdit`,
            data: Qs.stringify(params)
        }).then(
            (response) => response, (error) => error
        );
    }
    // 用户删除
    userDel(self, params) {
        return self.$axios({
            method: 'post',
            url: `/api/User/userDel`,
            data: Qs.stringify(params)
        }).then(
            (response) => response, (error) => error
        );
    }
    // 用户组列表
    getUserGroup(self, params) {
        return self.$axios({
            method: 'post',
            url: '/api/User/userGroupList',
            data: params
        }).then(
            (response) => response, (error) => error
        )
    }
    // 用户组编辑
    editUsergroup(self, params) {
        return self.$axios({
            method: 'post',
            url: '/api/User/userGroupEdit',
            data: Qs.stringify(params)
        }).then(
            (response) => response, (error) => error
        )
    }
    // 用户添加
    addUser(self, params) {
        return self.$axios({
            method: 'post',
            url: '/api/User/userAdd',
            data: Qs.stringify(params)
        }).then(
            (response) => response, (error) => error
        )
    }
    // 保存用户组添加
    saveUserGroupAdd(self, params) {
        return self.$axios({
            method: 'post',
            url: '/api/User/userGroupAdd',
            data: params
        }).then(
            (response) => response, (error) => error
        )
    }
    // 评论列表
    getDisList(self, params) {
        return self.$axios({
            method: 'post',
            url: '/api/Discuss/disList',
            data: params
        }).then(
            (response) => response, (error) => error
        )
    }
    // 模板上传
    importHandle(self, params) {
        return self.$axios({
            method: 'post',
            url: '/api/Discuss/importHandle',
            data: params
        }).then(
            (response) => response, (error) => error
        )
    }
    // 评论删除
    disDel(self, params) {
        return self.$axios({
            method: 'post',
            url: '/api/Discuss/disDel',
            data: params
        }).then(
            (response) => response, (error) => error
        )
    }
    // 删除图片
    imgDel(self, params) {
        return self.$axios({
            method: 'post',
            url: '/api/Discuss/imgDel',
            data: params
        }).then(
            (response) => response, (error) => error
        )
    }
    // getProList 获得产品列表
    getProList(self, params) {
        return self.$axios({
            method: 'post',
            url: '/api/Discuss/getProList',
            data: params
        }).then(
            (response) => response, (error) => error
        )
    }
    // getProList 保存
    disAdd(self, params) {
        return self.$axios({
            method: 'post',
            url: '/api/Discuss/disAdd',
            data: params
        }).then(
            (response) => response, (error) => error
        )
    }
    // 评论编辑
    disEdit(self, params) {
        return self.$axios({
            method: 'post',
            url: '/api/Discuss/disEdit',
            data: params
        }).then(
            (response) => response, (error) => error
        )
    }
    // 订单列表
    orderList(self, params) {
        return self.$axios({
            method: 'post',
            url: '/api/Order/orderList',
            data: params
        }).then(
            (response) => response, (error) => error
        )
    }
    // 审核
    orderCheck(self, params) {
        return self.$axios({
            method: 'post',
            url: '/api/Order/orderCheck',
            data: params
        }).then(
            (response) => response, (error) => error
        )
    }
    // 首页数据汇总
    homeData(self) {
        return self.$axios({
            method: 'post',
            url: '/api/Home/homeData',
        }).then(
            (response) => response, (error) => error
        )
    }
    // // 产品列表
    // getProList(self, params) {
    //     return  self.$axios({
    //         method:'post',
    //         url: '/api/Discuss/getProList',
    //         data: params
    //     }).then(
    //         (response) =>response, (error) =>error
    //     )
    // }

    // 文章添加
    saveArticle(self, params) {
        return self.$axios({
            method: 'post',
            url: '/api/article/articleAdd',
            data: params
        }).then(
            (response) => response, (error) => error
        )
    }

    // 文章列表
    getArticle(self, params) {
        return self.$axios({
            method: 'post',
            url: '/api/article/articleList',
            data: params
        }).then(
            (response) => response, (error) => error
        )
    }

    // 文章编辑
    editArticle(self, params) {
        return self.$axios({
            method: 'post',
            url: '/api/article/articleEdit',
            data: params
        }).then(
            (response) => response, (error) => error
        )
    }

    // 文章删除
    delArticle(self, params) {
        return self.$axios({
            method: 'post',
            url: '/api/article/articleDel',
            data: params
        }).then(
            (response) => response, (error) => error
        )
    }

    // 文章恢复
    restoreArticle(self, params) {
        return self.$axios({
            method: 'post',
            url: '/api/article/articleCover',
            data: params
        }).then(
            (response) => response, (error) => error
        )
    }

    // 货币列表
    getCurrencyList(self, params) {
        return self.$axios({
            method: 'post',
            url: '/api/Currency/currencyList',
            data: params
        }).then(
            (response) => response, (error) => error
        )
    }

    // 支付列表
    getPayInfoList(self, params) {
        return self.$axios({
            method: 'post',
            url: '/api/Pay/payInfoList',
            data: params
        }).then(
            (response) => response, (error) => error
        )
    }

    // 服务商列表
    getMerchantList(self, params) {
        return self.$axios({
            method: 'post',
            url: '/api/Pay/merchantList',
            data: params
        }).then(
            (response) => response, (error) => error
        )
    }

    // 支付编辑
    payInfoEdit(self, params) {
        return self.$axios({
            method: 'post',
            url: '/api/Pay/payInfoEdit',
            data: params
        }).then(
            (response) => response, (error) => error
        )
    }

    // 支付删除
    payInfoDelFn(self, params) {
        return self.$axios({
            method: 'post',
            url: '/api/Pay/payInfoDel',
            data: params
        }).then(
            (response) => response, (error) => error
        )
    }

    // 支付添加
    payInfoAdd(self, params) {
        return self.$axios({
            method: 'post',
            url: '/api/Pay/payInfoAdd',
            data: params
        }).then(
            (response) => response, (error) => error
        )
    }

    // 产品列表
    getproductData(self, params) {
        return self.$axios({
            method: 'post',
            url: '/api/Product/proList',
            data: params
        }).then(
            (response) => response, (error) => error
        )
    }

    // 产品添加
    productAdd(self, params) {
        return self.$axios({
            method: 'post',
            url: '/api/Product/proAdd',
            data: params
        }).then(
            (response) => response, (error) => error
        )
    }

    // 产品编辑
    productEdit(self, params) {
        return self.$axios({
            method: 'post',
            url: '/api/Product/proEdit',
            data: params
        }).then(
            (response) => response, (error) => error
        )
    }

    // 产品删除
    productDel(self, params) {
        return self.$axios({
            method: 'post',
            url: '/api/Product/proDel',
            data: params
        }).then(
            (response) => response, (error) => error
        )
    }

    // 产品图片上传
    productImgUpload(self, params) {
        return self.$axios({
            method: 'post',
            url: '/api/Product/imgUpload',
            data: params
        }).then(
            (response) => response, (error) => error
        )
    }

    // 产品短信配置展示
    productSmsShow(self, params) {
        return self.$axios({
            method: 'post',
            url: '/api/Product/smsShow',
            data: params
        }).then(
            (response) => response, (error) => error
        )
    }

    // 产品短信配置编辑
    productSmsManager(self, params) {
        return self.$axios({
            method: 'post',
            url: '/api/Product/smsManager',
            data: params
        }).then(
            (response) => response, (error) => error
        )
    }

    // 套餐产品选择列表
    mealProList(self, params) {
        return self.$axios({
            method: 'post',
            url: '/api/Product/mealProList',
            data: params
        }).then(
            (response) => response, (error) => error
        )
    }

    // 图片删除接口
    imgProDel(self, params) {
        return self.$axios({
            method: 'post',
            url: '/api/Product/imgDel',
            data: params
        }).then(
            (response) => response, (error) => error
        )
    }

    // 获取主页管理域名列表
    getDomainList(self, params) {
        return self.$axios({
            method: 'post',
            url: '/api/Home/domainList',
            data: params
        }).then(
            (response) => response, (error) => error
        )
    }

    // 获取主页管理列表
    getHomeList(self, params) {
        return self.$axios({
            method: 'post',
            url: '/api/Home/homeList',
            data: params
        }).then(
            (response) => response, (error) => error
        )
    }

    // 添加主页管理列表
    addHomeList(self, params) {
        return self.$axios({
            method: 'post',
            url: '/api/Home/homeAdd',
            data: params
        }).then(
            (response) => response, (error) => error
        )
    }

    // 编辑主页管理列表
    editHomeList(self, params) {
        return self.$axios({
            method: 'post',
            url: '/api/Home/homeEdit',
            data: params
        }).then(
            (response) => response, (error) => error
        )
    }

    // 主页管理轮播图列表
    getBannerList(self, params) {
        return self.$axios({
            method: 'post',
            url: '/api/Home/bannerList',
            data: params
        }).then(
            (response) => response, (error) => error
        )
    }

    // 主页管理轮播图添加产品选择
    bannerAddProList(self, params) {
        return self.$axios({
            method: 'post',
            url: '/api/Home/bannerAddProList',
            data: params
        }).then(
            (response) => response, (error) => error
        )
    }

    // 主页管理轮播图添加
    bannerAdd(self, params) {
        return self.$axios({
            method: 'post',
            url: '/api/Home/bannerAdd',
            data: params
        }).then(
            (response) => response, (error) => error
        )
    }

    // 主页管理轮播图编辑
    bannerEdit(self, params) {
        return self.$axios({
            method: 'post',
            url: '/api/Home/bannerEdit',
            data: params
        }).then(
            (response) => response, (error) => error
        )
    }

    // 主页管理轮播图删除
    bannerDel(self, params) {
        return self.$axios({
            method: 'post',
            url: '/api/Home/bannerDel',
            data: params
        }).then(
            (response) => response, (error) => error
        )
    }

    // 主页管理图片上传
    imgUpload(self, params) {
        return self.$axios({
            method: 'post',
            url: '/api/Home/imgUpload',
            data: params
        }).then(
            (response) => response, (error) => error
        )
    }

    // 主页管理首页产品列表
    getHomeProList(self, params) {
        return self.$axios({
            method: 'post',
            url: '/api/Home/homeProList',
            data: params
        }).then(
            (response) => response, (error) => error
        )
    }

    // 产品分类列表
    getProCateList(self, params) {
        return self.$axios({
            method: 'post',
            url: '/api/Product/proCateList',
            data: params
        }).then(
            (response) => response, (error) => error
        )
    }
    // 产品分类保存
    proCateAdd(self, params) {
        return self.$axios({
            method: 'post',
            url: '/api/Product/proCateAdd',
            data: params
        }).then(
            (response) => response, (error) => error
        )
    }

    // 产品分类保存
    proCateEdit(self, params) {
        return self.$axios({
            method: 'post',
            url: '/api/Product/proCateEdit',
            data: params
        }).then(
            (response) => response, (error) => error
        )
    }

    // 产品分类删除
    proCateDel(self, params) {
        return self.$axios({
            method: 'post',
            url: '/api/Product/proCateDel',
            data: params
        }).then(
            (response) => response, (error) => error
        )
    }
    // 产品优化师
    proTeacher(self) {
        return self.$axios({
            method: 'get',
            url: '/api/User/adUserList',
        }).then(
            (response) => response, (error) => error
        )
    }
}


export default new Service()
